#pragma once

#include <guiframe/IModule.h>
#include <qbnet/include/network_service.h>

class QbTFBondModule 
	: public IModule
	, public CUnknownObject<INetworkEventObserver>
{
public:
	static QbTFBondModule& instance();
	IApplication* app() const { return m_app; }

    bool showWebPage(const QString& url);
protected:
	// 通过 IModule 继承
	void initialize(IApplication* app) override;
	void unInitialize() override;
	int execCommand(CmdInfo ci) const override;
	bool closeCommandWindow(int cmdId, QWidget* widget) override;
	void requestTFBondData();
	void registNetEvent();
	void unRegistNetEvent();

	// INetworkEventObserver
	STDMETHOD_(void, OnForceQuit) (THIS_ int32_t connect_id) {}
	STDMETHOD_(void, OnDisConnect) (THIS_ int32_t connect_id) {}
	STDMETHOD_(void, OnRecover) (THIS_ int32_t connect_id);

private:
	QbTFBondModule() = default;

private:
	IApplication* m_app = nullptr;
};
